/**************************************************************************
 *                                                                        *
 *         Copyright (c) 2007 by Sunplus mMedia Inc.                      *
 *                                                                        *
 *  This software is copyrighted by and is the property of Sunplus        *
 *  mMedia Inc. All rights are reserved by Sunplus mMedia Inc.  This      *
 *  software may only be used in accordance with the corresponding        *
 *  license agreement. Any unauthorized use, duplication, distribution,   *
 *  or disclosure of this software is expressly forbidden.                *
 *                                                                        *
 *  This Copyright notice MUST not be removed or modified without prior   *
 *  written consent of Sunplus mMedia Inc.                                *
 *                                                                        *
 *  Sunplus mMedia Inc. reserves the right to modify this software        *
 *  without notice.                                                       *
 *                                                                        *
 *  Sunplus mMedia Inc.                                                   *
 *  19-1, Innovation First Road, Science-Based Industrial Park,           *
 *  Hsin-Chu, Taiwan, R.O.C.                                              *
 *                                                                        *
 **************************************************************************/

#ifndef _cardopt_H_
#define _cardopt_H_

#include "chipopt.h"


#define K_DELETE_LFN		1

// this case should not happen K_SUPPORT_NEWNAND = 0, K_SUPPORT_ONLYNEWNAND = 1
// thse 2 option apply only to nand
#if (NANDF_OPTION)
#define K_SUPPORT_NEWNAND	1
#define K_SUPPORT_ONLYNEWNAND	0
#else
#define K_SUPPORT_NEWNAND	0
#define K_SUPPORT_ONLYNEWNAND	0
#endif

#if (K_SUPPORT_ONLYNEWNAND)
#undef P_NAND_SIZE
#define P_NAND_SIZE		256
#endif

#define CARDLIB_RELEASE		1
#define K_SLASH /

#if CARDLIB_RELEASE
#define M_Card_Printf;/K_SLASH
#else
#define M_Card_Printf printf
#endif

#include "setmode.h"
#include "device.h"
#define K_MEDIA_NONE                    K_MEDIA_None
#ifdef DISK_DRV_SPI
#define K_MEDIA_NANDF                   K_MEDIA_Spi
#else
#define K_MEDIA_NANDF                   K_MEDIA_Nandf
#endif
#define K_MEDIA_SMC                     K_MEDIA_Smc
#if (CFAIDE)
#define K_MEDIA_CFC                     K_MEDIA_CfcIde
#else
#define K_MEDIA_CFC                     K_MEDIA_CfcMem
#endif

#define K_MEDIA_SDF                     K_MEDIA_Sdf
#define K_MEDIA_MMC                     K_MEDIA_Mmc
#define K_MEDIA_NEXTF                   K_MEDIA_Nextf
#define K_MEDIA_DOSRAM			K_MEDIA_Sdram

#ifndef K_MEDIA_TYPE

#if (K_CARD_TYPE & K_NANDF_SUPPORTED)
#define K_MEDIA_TYPE			K_MEDIA_NANDF
#elif (K_CARD_TYPE & K_NORF_SUPPORTED)
#define K_MEDIA_TYPE			K_MEDIA_NORF
#elif (K_CARD_TYPE & K_NEXTF_SUPPORTED)
#define K_MEDIA_TYPE			K_MEDIA_NEXTF
//patch4.2@richie@ds0511 begin
#elif (K_CARD_TYPE & K_DOSRAM_SUPPORTED)
#define K_MEDIA_TYPE			K_MEDIA_DOSRAM
//patch4.2@richie@ds0511 end
#elif (K_CARD_TYPE & K_CFC_SUPPORTED)
#define K_MEDIA_TYPE			K_MEDIA_CFC
#elif (K_CARD_TYPE & K_SMC_SUPPORTED)
#define K_MEDIA_TYPE			K_MEDIA_SMC
#elif (K_CARD_TYPE & K_SDF_SUPPORTED)
#define K_MEDIA_TYPE			K_MEDIA_SDF
#elif (K_CARD_TYPE & K_MMC_SUPPORTED)
#define K_MEDIA_TYPE			K_MEDIA_MMC
#endif

#endif

//HIS101b-0025
#ifndef K_MEDIA_ONLYONE
#if (K_CARD_TOTAL <= 1)
#define K_MEDIA_ONLYONE			1
#else
#define K_MEDIA_ONLYONE			0
#endif
#endif

#ifndef K_MEDIA_UI_OPTION
#define K_MEDIA_UI_OPTION		0
#endif

#define K_MEDIA_NewForOldBlk		0x0001
#define K_MEDIA_HasBlockBoundary	0x0002
#define K_MEDIA_EraseBefOverWrite	0x0004
#define K_MEDIA_AutoAdress		0x0008

#define K_MEDIA_SMC_Behavior		( K_MEDIA_NewForOldBlk | K_MEDIA_HasBlockBoundary )
#define K_MEDIA_CF_Behavior		( K_MEDIA_AutoAdress )
#define K_MEDIA_DRM_Behavior		( K_MEDIA_AutoAdress ) // HIS101a-0002
#define K_MEDIA_SD_Behavior        	K_MEDIA_AutoAdress
#define K_MEDIA_MMC_Behavior       	( K_MEDIA_AutoAdress )

//When record avi WITH audio, should turn on this option.
//This option search all free clusters before recording. This
//prevent audio and video not sync problem when the clusters
//are not very contiguous.But this option require many pre-processing
//time when searching whole BIG capacity flash with SMALL cluster.
//It is suggested that you define the time to record for your product,
//then caluclate approximate size require to search. For example, if
//you define your product could record 200 second, also assume that
//frame rate for your product is 10, and maximal size of each frame
//is 12K, the require size is 200*10*12K = 24,000K + 500K = 24,500K.
//If G_DOS_ClusterSize is 2K, then 24,500K/2K=12,250 cluster. Then
//set this value to G_DOS_LinearFATMax before calling file recording
//function. G_DOS_LinearFATMax is initial in Card_InitGlobal at cardlink.c
//to 0xFFFF(maximal clusters) whcih search whole flash.								// use asic find pattern to do FAT search
#define K_Use_Pat_FAT			0			// 1528 could be 1

#define K_File_HaveVideo	        1

// K_File_HaveVideo must on, when this option is on
#define K_File_HaveMpegAvi	        1			// HIS120-0001 // used by 503, 504

#define K_File_HaveWaveCardFull	        1			// HIS120-0005 // used by 503, 504
#define K_File_HaveAviInterlace	        0			// HIS120-0006 // used by 503, 504

#if (K_File_HaveMpegAvi == 0)					// used by 503, 504
// sorry, old avi format doesn't support interlace
#undef K_File_HaveAviInterlace
#define K_File_HaveAviInterlace         0
#endif

// when this is on, it means capture the video image to SDRAM
#define K_File_PutVideoAtDram			1

// DEBUG mode
// this flag has effect only when K_File_PutVideoAtDram is 1
// when this is on, it means capture only the first frame of video image
#define K_File_RptSameVideoAtDram		0

// HIS101a-0003
#define K_Audio_Codec_OnlyNonCompressed		0
#define K_Audio_Codec_OnlyIMACompressed		1

#endif /*__cardopt_H__*/

